import { Schema, Types, model } from 'mongoose'
// gpt聊天信息
const GptMessageSchema = new Schema(
  {
    user_id: {
      type: Types.ObjectId,
      ref: 'GptUser',
    },
    dialog_id: {
      type: Types.ObjectId,
      ref: 'GptDialog',
      required: true
    },
    content: {
      type: String,
      required: true
    },
    prompt: {
      type: [String]
    },
    role: {
      type: String,
      enum: ['user', 'assistant'],
      required: true
    }
  },
  { versionKey: false, timestamps: true }
)

export default model('GptMessage', GptMessageSchema, 'gpt_messages')
